test: show full error message on test failure#1364
Conversation
Remove 300-character truncation of exception messages in the test runner. The limit was cutting off valuable diagnostic info — e.g. the tolerance's rel: value — making failures harder to diagnose.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
Code Review by Qodo
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change modifies how exceptions are displayed in error output. Previously, exception strings were explicitly truncated to 300 characters before being printed. The update removes this truncation logic and instead prints the full exception object directly. The exception string is still converted to lowercase and used for hint logic and error categorization downstream, so the control flow and decision-making remain unchanged—only the display formatting behavior is altered. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if len(exc_str) > 300: | ||
| exc_str = exc_str[:297] + "..." | ||
| cons.print(f" Error: {exc_str}") | ||
| cons.print(f" Error: {exc}") |
There was a problem hiding this comment.
1. Markup-parsed error crashes 🐞 Bug ☼ Reliability
In handle_case, the exception message is printed through Rich with markup parsing enabled, so exception strings containing [/] can be interpreted as markup and raise a Rich rendering error while reporting the failure. This can interrupt the test runner’s failure reporting and hide the original test error.
Agent Prompt
## Issue description
`handle_case` prints exception text via Rich markup parsing. If the exception message contains `[` / `]` sequences, Rich may interpret them as markup and raise during printing, masking the original test failure.
## Issue Context
The printer wrapper uses `rich.console.Console()` and forwards strings to `Console.print()` without escaping, so markup parsing is on by default.
## Fix Focus Areas
- toolchain/mfc/test/test.py[609-616]
- toolchain/mfc/printer.py[7-40]
## Suggested change
Print the error line with markup disabled (or escape the exception text). For example:
- `cons.print(f" Error: {exc}", markup=False)`
Optionally preserve formatting for your own exceptions only:
- `cons.print(f" Error: {exc}", markup=isinstance(exc, MFCException))`
(or escape only when not an `MFCException`).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1364 +/- ##
==========================================
+ Coverage 64.88% 64.91% +0.02%
==========================================
Files 70 70
Lines 18251 18251
Branches 1508 1508
==========================================
+ Hits 11842 11847 +5
+ Misses 5446 5441 -5
Partials 963 963 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
handle_caseintoolchain/mfc/test/test.py)rel:value in the tolerance line was being truncated tore...Test plan
abs:andrel:) is displayed in the failure output